const columns = (FormModal, AuthModal, onRemove, namespace) => {
  return [
    {
        type: 'selection',
        title: '#',
        width:50,
        fixed: 'left'
    },
    {
        type: 'index',
        width: 60,
        align: 'center',
        fixed: 'left'
    },
    {
        title: '用户名',
        key: 'username',
        width:120
    },
    {
        title: '性别',
        key: 'gender',
        width:80,
        render (row, column, index) {
            return '你好'
        }
    },
    {
        title: '身份证号码',
        width:180,
        key: 'idcard'
    },
    {
        title: '出生日期',
        width:140,
        key: 'birthday'
    },
    {
        title: '邮箱',
        width:180,
        key: 'email'
    },
    {
        title: '联系电话',
        width:140,
        key: 'phone'
    },
    {
        title: '工作职位',
        width:150,
        key: 'job'
    },
    {
        title: '是否锁住',
        width:100,
        key: 'locked',
        render (row, column, index) {
          if(row.locked === '1') {
            return '已锁定'
          } else {
            return '未锁定'
          }
        }
    },
    {
        title: '拥有角色',
        key: 'roleNames',
        width:400
    },
    {
        title: '注册日期',
        key: 'ctime',
        width:180
    },
    {
        title: '维护日期',
        key: 'mtime',
        width:180
    },
    {
        title: '操作',
        key: 'operation',
        width: 180,
        fixed: 'right',
        render: (h, { row, column, index }) => {
          return h('div', [
              h(AuthModal, {
                  props: {
                      record: row,
                      namespace,
                  }
              }, '授权'),
              h(FormModal, {
                  props: {
                      title: '编辑权限',
                      record: row,
                      option: 'update',
                      namespace,
                      type: 'text',
                      size: 'small',
                      perm: 'user:update'
                  }
              }, '编辑'),
              h('IButton', {
                  props: {
                      type: 'text',
                      size: 'small',
                      click: true,
                      perm: 'user:remove'
                  },
                  on: {
                      click: () => onRemove(row.id_)
                  }
              }, '删除')
          ]);
      }
    }
  ]
}


export default columns
